package com.itheima.stock.config;


import com.google.common.util.concurrent.RateLimiter;
import com.itheima.stock.properties.LimiterProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@SuppressWarnings("all")
public class RateLimiterConfiguration {

    @Autowired
    LimiterProperties properties;
    @Bean
    public RateLimiter rateLimiter(){
        return  RateLimiter.create(properties.getConcurrentNum());
    }
}
